<!DOCTYPE html>
<html class="client-nojs vector-feature-language-in-header-enabled vector-feature-language-in-main-page-header-disabled vector-feature-page-tools-pinned-disabled vector-feature-toc-pinned-clientpref-0 vector-toc-not-available vector-feature-main-menu-pinned-disabled vector-feature-limited-width-clientpref-1 vector-feature-limited-width-content-enabled vector-feature-custom-font-size-clientpref-1 vector-feature-appearance-pinned-clientpref-0 vector-feature-night-mode-enabled skin-theme-clientpref-os vector-sticky-header-enabled" lang="fr" dir="ltr"><head>
<meta charset="UTF-8">
<title>Netstat</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" type="image/png" href="./_res_/favicon.png">
<link rel="canonical" href="https://fr.wikipedia.org/wiki/Netstat"> <link href="./_mw_/ext.pygments.css" rel="stylesheet" type="text/css">
<link href="./_mw_/ext.wikimediamessages.styles.css" rel="stylesheet" type="text/css">
<link href="./_mw_/skins.vector.icons.css" rel="stylesheet" type="text/css">
<link href="./_mw_/skins.vector.search.codex.styles.css" rel="stylesheet" type="text/css">
<link href="./_mw_/skins.vector.styles.css" rel="stylesheet" type="text/css">
<meta name="ResourceLoaderDynamicStyles" content="">
<link rel="stylesheet" type="text/css" href="./_mw_/site.styles.css">
<link rel="stylesheet" type="text/css" href="./_mw_/noscript.css">
<link rel="stylesheet" type="text/css" href="./_res_/footer.css">
<link rel="stylesheet" type="text/css" href="./_res_/vector-2022.css">
</head>
<body class="skin--responsive skin-vector skin-vector-search-vue mediawiki ltr sitedir-ltr mw-hide-empty-elt ns-0 ns-subject page-Netstat rootpage-Netstat skin-vector-2022 action-view">
<div class="mw-page-container">
<div class="mw-page-container-inner">
<div class="mw-content-container">
<main id="content" class="mw-body">
<header class="mw-body-header vector-page-titlebar">
<h1 id="firstHeading" class="firstHeading mw-first-heading">netstat</h1>
</header>
<a id="top"></a>
<div id="bodyContent" class="vector-body ve-init-mw-desktopArticleTarget-targetContainer" aria-labelledby="firstHeading" data-mw-ve-target-container="">
<div id="contentSub">
<div id="mw-content-subtitle"></div>
</div>
<div id="mw-content-text" class="mw-body-content mw-content-ltr" lang="fr" dir="ltr"><div class="mw-content-ltr mw-parser-output" lang="fr" dir="ltr"><p class="mw-empty-elt">
</p>
<div class="infobox_v3 infobox infobox--frwiki noarchive" style="width:260px">
<div class="entete icon informatique" style="color: #000000;"><style data-mw-deduplicate="TemplateStyles:r228712691">
/* start https://fr.wikipedia.org/ */
.mw-parser-output .entete.informatique{background-image:url("./_mw_/Picto.nfo.png")}
/* end https://fr.wikipedia.org/ */
</style>
<div>Netstat</div>
</div>
<p class="mw-empty-elt">
</p>
<div class="images">
</div>
<table><caption style="color:#000000;">Informations</caption>
<tbody><tr>
<th scope="row"> Type
</th>
<td>
<span class="wd_p31">Utilitaire de ligne de commande <small>(<a href="https://www.wikidata.org/wiki/Q115214659" class="extiw external" title="d:Q115214659"><span class="indicateur-langue" title="Voir l'élément Wikidata correspondant">d</span></a>)</small><br><a href="Logiciel_utilitaire" title="Logiciel utilitaire">Logiciel utilitaire</a><br><a href="Commande_informatique" title="Commande informatique">Commande informatique</a></span></td>
</tr>
</tbody></table>
<p class="mw-empty-elt">
</p>
</div>
<p><code><b>netstat</b></code>, pour « <b>net</b>work <b>stat</b>istics », est une ligne de commande affichant des informations sur les connexions réseau, les tables de routage et un certain nombre de statistiques dont ceux des interfaces, sans oublier les connexions masquées, les membres <b>multicast</b>, et enfin, les messages <b>netlink</b>. La commande est disponible sous <a href="Unix" title="Unix">Unix</a> (et ses dérivés dont <a href="Linux" title="Linux">Linux</a>) et sous <a href="Windows" class="mw-redirect" title="Windows">Windows</a> NT compatibles.
</p><p><br>
</p>
<div class="mw-heading mw-heading2"><h2 id="Utilisations">Utilisations</h2></div>
<p>Les paramètres utilisés avec cette commande doivent être préfixés avec un « tiret » plutôt qu'un slash (/).
</p><p>-a : Affiche toutes les connexions TCP actives et les ports TCP et UDP sur lesquels l'ordinateur écoute.
</p><p>-b : Affiche le nom du programme impliqué dans la création de chaque connexion et ports ouverts (Windows uniquement).
</p><p>-p : Affiche le nom du programme impliqué dans la création de chaque connexion et le PID associé (Linux uniquement).
</p><p>-e : Affiche les statistiques <a href="Ethernet" title="Ethernet">ethernet</a> comme le nombre d'octets et de paquets envoyés et reçus. Ce paramètre peut être combiné avec -s.
</p><p>-n : Affiche les connexions TCP actives, cependant les adresses et les ports sont affichés au format numérique, sans tentative de résolution de nom.
</p><p>-o : Affiche les connexions TCP actives et inclut l'identifiant du processus (PID) pour chaque connexion. Vous pouvez retrouver la correspondance entre les PID et les applications dans le gestionnaire des tâches de Windows. Ce paramètre peut être combiné avec -a, -n et -p. Ce paramètre est disponible sous Windows XP, et Windows 2003 Server mais pas sous Windows 2000.
</p><p>-i : Affiche les interfaces réseaux et leurs statistiques (non disponibles sous Windows).
</p><p>-r : Affiche le contenu de la table de routage (équivalent à route print sous Windows).
</p><p>-s : Affiche les statistiques par protocole. Par défaut, les statistiques sont affichées pour IP, <a href="IPv6" title="IPv6">IPv6</a>, ICMP, ICMPv6, TCP, TCPv6, UDP et UDPv6. L'option -p peut être utilisée pour spécifier un sous-jeu de la valeur par défaut.
</p><p>/? : Affiche l'aide (seulement sous Windows).
</p>
<div class="mw-heading mw-heading2"><h2 id="Spécificités_pour_Windows"><span id="Sp.C3.A9cificit.C3.A9s_pour_Windows"></span>Spécificités pour Windows</h2></div>
<p>Sur les plateformes <a href="Windows" class="mw-redirect" title="Windows">Windows</a>, les informations retournées peuvent être retrouvées par l'appel de la fonction <a href="Interface_de_programmation" title="Interface de programmation">API</a> <i>GetTcpTable()</i> et <i>GetUdpTable()</i> implémentées dans la bibliothèque IPHLPAPI.DLL. Les informations retournées sont les adresses <a href="Internet_Protocol" title="Internet Protocol">IP</a> locales et distantes, les ports locaux et distants et pour <i>GetTcpTable()</i> les codes de statut <a href="Transmission_Control_Protocol" title="Transmission Control Protocol">TCP</a>. La commande est valable lorsque le protocole TCP/IP est installé comme composant dans les propriétés de la <a href="Connexion_r%C3%A9seau" title="Connexion réseau">connexion réseau</a>.
</p>
<div class="mw-heading mw-heading3"><h3 id="Exemple">Exemple</h3></div>
<p>Dans cet exemple on voit deux connexions établies sur les ports 1922 et 1924 entre un serveur appelé <i>SRVX</i> et un des serveurs de Wikipédia :
</p>
<div class="mw-highlight mw-highlight-lang-bat mw-content-ltr" dir="ltr"><pre><span></span> C:\<span class="p">></span>netstat
Connexions actives
Proto Adresse locale Adresse distante Etat
TCP SRVX:1922 rr.knams.wikimedia.org:http ESTABLISHED
TCP SRVX:1924 rr.knams.wikimedia.org:http ESTABLISHED
</pre></div>
<p>Pour déterminer le service qui écoute le port 22 sur Ubuntu (en étant connecté en SSH du 192.168.0.3 sur le 192.168.0.2) :
</p>
<div class="mw-highlight mw-highlight-lang-bash mw-content-ltr" dir="ltr"><pre><span></span><span class="w"> </span>netstat<span class="w"> </span>-pano<span class="w"> </span><span class="p">|</span>grep<span class="w"> </span>:22
tcp<span class="w"> </span><span class="m">0</span><span class="w"> </span><span class="m">0</span><span class="w"> </span><span class="m">0</span>.0.0.0:22<span class="w"> </span><span class="m">0</span>.0.0.0:*<span class="w"> </span>LISTEN<span class="w"> </span><span class="m">5359</span>/sshd<span class="w"> </span>off<span class="w"> </span><span class="o">(</span><span class="m">0</span>.00/0/0<span class="o">)</span>
tcp<span class="w"> </span><span class="m">0</span><span class="w"> </span><span class="m">64</span><span class="w"> </span><span class="m">192</span>.168.0.2:22<span class="w"> </span><span class="m">192</span>.168.0.3:29637<span class="w"> </span>ESTABLISHED<span class="w"> </span><span class="m">7826</span>/1<span class="w"> </span>sur<span class="w"> </span><span class="o">(</span><span class="m">0</span>,40/0/0<span class="o">)</span>
tcp6<span class="w"> </span><span class="m">0</span><span class="w"> </span><span class="m">0</span><span class="w"> </span>:::22<span class="w"> </span>:::*<span class="w"> </span>LISTEN<span class="w"> </span><span class="m">5359</span>/sshd<span class="w"> </span>off<span class="w"> </span><span class="o">(</span><span class="m">0</span>.00/0/0<span class="o">)</span>
</pre></div>
<div class="mw-heading mw-heading2"><h2 id="Voir_aussi">Voir aussi</h2></div>
<div class="mw-heading mw-heading3"><h3 id="Liens_internes">Liens internes</h3></div>
<ul><li><a href="Nslookup" title="Nslookup">nslookup</a></li>
<li><a href="Dig_(programme_informatique)" title="Dig (programme informatique)">dig (programme informatique)</a></li></ul>
<div class="mw-heading mw-heading3"><h3 id="Liens_externes">Liens externes</h3></div>
<ul><li><a rel="nofollow" class="external text" href="https://technet.microsoft.com/fr-fr/library/bb490947(en-us).aspx">Microsoft Windows XP - Netstat</a></li>
<li><a rel="nofollow" class="external text" href="https://www.grc.com/SecurityNow.htm#49">Security Now #49 - The NETSTAT Command (guide)</a></li></ul>
<div class="navbox-container" style="clear:both;">
</div>
<ul id="bandeau-portail" class="bandeau-portail"><li><span class="bandeau-portail-element"><span class="bandeau-portail-icone"><span class="noviewer" typeof="mw:File"></span></span> <span class="bandeau-portail-texte">Portail de la sécurité des systèmes d'information</span> </span></li> </ul></div><!--htdig_noindex--><div><div class="zim-footer">
Cet article est issu de <a class="external text" title="Dernière modification le 2025-05-12" href="https://fr.wikipedia.org/wiki/?title=Netstat&oldid=225614977">Wikipédia</a>. Sauf mention contraire, le texte est disponible sous <a class="external text" href="https://creativecommons.org/licenses/by-sa/4.0/deed.fr">Creative Commons Attribution-Share Alike 4.0</a>. Des conditions supplémentaires peuvent s’appliquer aux fichiers multimédias.
</div>
</div><!--/htdig_noindex--></div>
</div>
</main>
</div>
</div>
</div>
<script src="./_webp_/webpHandler.js"></script>
</body></html>